package com.ysd.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102800774490";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDmLxzAR0S8lkVXaBYupP2y0X/WO5hS3At2zIVvYG60b4NKEx+j20XklF+9PWaxFH+M8c9cLuxqWnFBZn512k5poPuOsPBP3boIXCUmqKcFf3DAU5bqC2TdtJ5y7rkRqCnQ/OihoXDTTW57A3GkgJzZGTkYAZZ7VFvpW6eQ0aJHyAEjVwWKGvbSYiyQUeQTsY0cHbkC9oPN4djF23LymcGrmVjvq9nua8PVxx6NRYKuwa4zP1MFvbtrixJVBwtE3K4h+iALTTlcVIE5abmldrZsxsICd4CsPX59RydRxyU86ZTgxUzOC6VajRIciEs1eCWqxA72gnExtmYyenOEhy0xAgMBAAECggEBAIn4HzGZBjhLkhCMEQ+wUWiHbiqI2gqAXla8zBYwJOr+FCGoSMS8P658yM3zKcRmVvWyUuocLhSpVU0wFAir62gg1+d1YvVcH4+3O4VqfYIsGvcMo15xqenBw198e2178GSV0xJeY/Qja19Mdyd0946hMbmT6hDORbEgANYq8Sw4MHuX1mA0uzSzukqqA5wp/1et1vvqeILX702SkG0BMxDYm5DpQKUmMDbHC4jhhREW2G3y6QMWdg3cpadmS+W0lFbp85KfJsxRQruo7aupBDVdQBQZD1m4ut441n2rZzCNzLo8XKcH9WoLmUaO5fvT9NYeXO8NDfzaJEGIwmMNeeECgYEA9qR6DZs/2/W6GL47dABhr7lM4cPzct0LrdtjQ2L/KwnMKjOG7D0Ej5FyRrwymcpmWa56p/Ski1I3JKvg3NdwwlZ039TB53OwA2pjYelrnWlnXLf/p+I0mLMsSf2UFefopNqb/ibmOV9xr4/VHTagZd5ezvC3qpNei6JV/bMFdo0CgYEA7urIQfqKRatNzDj5yZDA3AGqfZZN0Cqc/Jiup5tFjezQZjXqSqYIN4GOh4B9tdjZLRlIDqwdXUXE4kF23bvytHgZ7RDRuFvwyQ+O4Le2K1Yg93U8+d1CYvYfXqKwzlGlwbbUX0ZxeNhqwM9oFmY3Kp/Pwbo1TwT/b+vbFF1cqjUCgYEAnUi8MOsdKSclututTEdmBEqVta9hE5HU/dTXE0URVh/UW+EqHIK44tks1+DyH9LLvEshGvRO7i3Kzo7xQcP9u2Co/YhO80t6JmN05x6Uqvhpmt4XobcGNY6lIrYb9nBCksZ6DfQ+gr3T4NJHZG7OkMfjC/LEHXoHI+KtFbFRPY0CgYBKNGu8ald16g3Ax1V1sFrmOjI8zWkfpYyau8VLU2OYABx+EnLRep4Et12QYm0pBM/3POnvfK+mH5xV9aU4mz53pPHQeq/Yhd3UZNuomgafkSGuGiC1Lm6HFBCMMRWfDybfcqylZtipgvYtKn4Wruqld3tsnSwffdrkZSnnOlQknQKBgFeAnRAZN6f+oQtlPZfUsPxV3YkoyVhAvROPrKjvE57cNbnFg5QjToteGMa38GeoeO3YuPPR+fpfh5n9gen29ZJ7JionIfGxLg5Cy05G86T33yt+ZwtuxYrcrEFwHVnWQbXPgXLaED8N2Ken90BdOn6mdxtIUBDmujZhQtX9ZEp8";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIgHnOn7LLILlKETd6BFRJ0GqgS2Y3mn1wMQmyh9zEyWlz5p1zrahRahbXAfCfSqshSNfqOmAQzSHRVjCqjsAw1jyqrXaPdKBmr90DIpIxmIyKXv4GGAkPyJ/6FTFY99uhpiq0qadD/uSzQsefWo0aTvP/65zi3eof7TcZ32oWpwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:88/shop-service-alipay/Alipay/notifyUrl";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:88/shop-service-alipay/Alipay/returnUrl";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

